import request from "../request";

const controller = "GalGame";

export const getGal_API = (data) => {
  return request.get(`${controller}/getGal?${queryStr(data)}`);
};

export const getGalList_API = () => {
  return request.get(`${controller}/getGalList`);
};

export const getGalListOfSelect_API = (data) => {
  return request.get(`${controller}/getGalListOfSelect?${queryStr(data)}`);
};

export const getGalTagList_API = () => {
  return request.get(`${controller}/getGalTagList`);
};

export const getGalTagListOfClub_API = () => {
  return request.get(`${controller}/getGalTagListOfClub`);
};

export const getGalTagListOfType_API = () => {
  return request.get(`${controller}/getGalTagListOfType`);
};

export const addGalTag_API = (data) => {
  return request.post(`${controller}/addGalTag`, queryStr(data));
};

export const addGalDownloadCount_API = (data) => {
  return request.post(`${controller}/addGalDownloadCount`, queryStr(data));
};

const queryStr = (data) => {
  let str = "";
  for (var key in data) {
    str += `${key}=${data[key]}&`;
  }
  if (str[str.length - 1] == "&") {
    str = str.substring(0, str.length - 1);
  }
  return str;
};
